<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html,
        body {
            height: 100%;
            width: 100%;
            overflow: hidden;
            background-image: url(./images/bg.jpg);
            background-repeat: no-repeat;
            background-size: 100% 100%;
        }
    </style>
    <script src="./js/aniamte.js"></script>
</head>

<body>

    <script>
        function Fireworm(el) {
            this.el = document.createElement("div");
            document.body.appendChild(this.el);
            this.el.style.width = "20px";
            this.el.style.height = "20px";
            this.el.style.position = "absolute";
            this.el.style.backgroundImage = 'url(./images/1.jpg)';
            this.el.style.backgroundRepeat = "no-repeat";
            this.el.style.backgroundSize = "100% 100%";
            this.el.style.left = this.location().left + "px";
            this.el.style.top = this.location().top + "px";
        }
        Fireworm.prototype = {
            constructor: Fireworm,
            location() {
                return {
                    left: parseInt(document.documentElement.clientWidth * Math.random()),
                    top: parseInt(document.documentElement.clientHeight * Math.random())
                }
            },
            fly() {
                tools.animate(this.el, this.location(), () => {
                    this.fly();
                })
            }
        }
        for (var i = 0; i < 9; i++) {
            new Fireworm().fly();
        }
    </script>
</body>

</html>